/*******************************************************************************
*                                                                              *
* This file provides a TSP SC implementation's functions  plugin.              *
*                                                                              *
*******************************************************************************/

#ifndef __TSP_PLUGIN_H__
#define __TSP_PLUGIN_H__

////////////////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////////////////

#include "SCSystem.hpp"
#include "SC_TSP_LibConfig.h"

////////////////////////////////////////////////////////////////////////////////
// Prototypes
////////////////////////////////////////////////////////////////////////////////

/**
 *	Initialises the plugin.
 *	This function is called when a plugin is loaded to initialise some data
 *	(like loading a file) before computation starts.
*/
LIBRARY_DECL void InitPlugin (const std::string &);

/**
 *	Closes the plugin properly.
 *	This function is called when a plugin is closed to finalise some data (like 
 *	closing a file or free memory) when computation ends.
*/
LIBRARY_DECL void ClosePlugin (void);

/**
 *	Initialises a system with a random path.
 *	@param sys1 System 1 : Path holder
 *	@param context Context system : Initialise a path and send its holder into
 *	the computation space
 *	@param sys2 System 2 : Computation space
*/
LIBRARY_DECL bool Initialise (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);

/**
 *	Selection and Evolution operations between two systems
 *	The selection is done by elitism or fitness proportionately and the
 *	evolution is done by crossover (CO) or by copy and mutation (CP).
 *	@param sys1 System 1 : Path holder
 *	@param context Context system : No context requirements
 *	@param sys2 System 2 : Path holder
*/
LIBRARY_DECL bool KB_CO_PMX (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool KB_CO_MOX (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool KB_CP_SWP (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool KB_CP_MOV (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool KB_CP_REV (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool FP_CO_PMX (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool FP_CO_MOX (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool FP_CP_SWP (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool FP_CP_MOV (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);
LIBRARY_DECL bool FP_CP_REV (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);

/**
 *	Self-adaptive function
 *	@param sys1 System 1 : Operator
 *	@param context Context system : No context requirements
 *	@param sys2 System 2 : Operator
*/
LIBRARY_DECL bool AdaptOp (SC::SCSystem &, const SC::SCSystem &, SC::SCSystem &);

////////////////////////////////////////////////////////////////////////////////

#endif
